import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/views/layout'

Vue.use(Router)

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/',
            component: Layout,
            redirect: '/main',
          },{
            path: '/main',
            name: 'Layout',
            component: Layout,
            redirect: '/main',
            children: [{
                    path: '/main',
                    name: 'main',
                    component: () =>
                        import ('@/views/main')
                },
                {
                    path: '/blogInfo/:id',
                    name: 'blogInfo',
                    component: () =>
                        import ('@/views/blog-info')
                },
                {
                    path: '/type',
                    name: 'type',
                    component: () =>
                        import ('@/views/type')
                },
                {
                    path: '/typeblog/:id',
                    name: 'typeblog',
                    component: () =>
                        import ('@/views/type-blog')
                },
                {
                    path: '/timeLine',
                    name: 'timeLine',
                    component: () =>
                        import ('@/views/time')
                },
                {
                    path: '/about',
                    name: 'about',
                    component: () =>
                        import ('@/views/about')
                },
                {
                    path: '/userCenter',
                    name: 'userCenter',
                    redirect: '/info',
                    component: () =>
                        import ('@/views/user-center'),
                    children: [{
                            path: '/info',
                            name: 'info',
                            component: () =>
                                import ('@/views/user-center/user-info')
                        },
                        {
                            path: '/collection',
                            name: 'collection',
                            component: () =>
                                import ('@/views/user-center/my-collection')
                        },
                        {
                            path: '/comment',
                            name: 'comment',
                            component: () =>
                                import ('@/views/user-center/my-comment')
                        },
                    ],
                },
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () =>
                import ('@/views/login')
        }
    ]
})